package com.touchwp.java.wechat.app;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

import com.touchwp.java.wechat.processor.PictureMessageProcessor;
import com.touchwp.java.wechat.processor.TextMessageProcesso;

/**
 * 初始化
 * 
 * @author yuki
 * @deprecated 使用ioc,不需要手动初始化
 * 
 */
@Deprecated
public class WeChatListener implements ServletContextListener {

	protected WeChatProcessor weChatProcessor;

	public WeChatListener() {
		super();
	}

	public void contextInitialized(ServletContextEvent sce) {
		weChatProcessor = new WeChatProcessor();
		weChatProcessor.addProcessor(new TextMessageProcesso());
		weChatProcessor.addProcessor(new PictureMessageProcessor());
		sce.getServletContext().setAttribute(WeChatProcessor.class.getName(), weChatProcessor);
	}

	public void contextDestroyed(ServletContextEvent sce) {
		weChatProcessor = null;
	}

}
